﻿using System;
using System.Globalization;
using System.Windows.Data;
using Dispatcher.LogicalModels;
using Repository;

namespace Dispatcher.Converters
{
    class PlaceEventToCellDataContextConverter : IValueConverter
    {
        private Place _place;

        public PlaceEventToCellDataContextConverter(Place place)
        {
            _place = place;
        }

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is DailyEvents)
            {
                var dailyEvents = (DailyEvents) value;
                return dailyEvents.Events[_place];
            }
            return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
